---
title: "Reference: Workflow.waitForEvent() | Workflows"
description: Documentation for the `Workflow.waitForEvent()` method in workflows, which pauses execution until an event is received.
---

# Workflow.waitForEvent()

The `.waitForEvent()` method pauses execution until an event is received.

## Usage example

```typescript copy
workflow.waitForEvent("event-name", step1);
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "eventName",
      type: "string",
      description: "The name of the event to wait for",
      isOptional: false,
    },
    {
      name: "step",
      type: "Step",
      description: "The step to resume after the event is received",
      isOptional: false,
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "workflow",
      type: "Workflow",
      description: "The workflow instance for method chaining",
    },
  ]}
/>

## Extended usage example

```typescript showLineNumbers copy
import { createWorkflow, createStep } from "@mastra/core/workflows";

const step1 = createStep({...});
const step2 = createStep({...});
const step3 = createStep({...});

export const testWorkflow = createWorkflow({...})
  .then(step1)
  .waitForEvent("event-name", step2)
  .then(step3)
  .commit();
```

## Related

- [.sendEvent()](./sendEvent)
- [Suspend & Resume](/docs/v1/workflows/suspend-and-resume#sleep--events)
